Method: ROM::Changeset.[]

Defined in:
changeset/lib/rom/changeset.rb

.[](relation_name) ⇒ Object

Create a changeset class preconfigured for a specific relation

Examples:

class NewUserChangeset < ROM::Changeset::Create[:users]
end

users.changeset(NewUserChangeset).data(name: 'Jane')


106
107
108
109
110
# File 'changeset/lib/rom/changeset.rb', line 106

def self.[](relation_name)
  fetch_or_store([relation_name, self]) {
    Class.new(self) { relation(relation_name) }
  }
end